package dao

import (
	"go-main/library/conf"
	"go-main/library/database/sql"
)

func NewDB() (db *sql.DB, cf func(), err error) {
	var cfg sql.Config
	if err = conf.Bind("db", &cfg); err != nil {
		return
	}
	db = sql.NewMySQL(&cfg)
	cf = func() { _ = db.Close() }
	return
}
